﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace _2_2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            double fahrenheit = Convert.ToDouble(textBox1.Text);
            double celsius = 5.0 / 9 * (fahrenheit - 32); // 注意用5.0避免整数除法
            textBox2.Text = celsius.ToString("F2");
        }

        private void button2_Click(object sender, EventArgs e)
        {
            double celsius = Convert.ToDouble(textBox2.Text);
            double fahrenheit = 9.0 / 5 * celsius + 32;
            textBox1.Text = fahrenheit.ToString("F2");
        }
    }
}
